<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    public function success($msg,$data=[]){
        $result = [
            'code'=>20000,
            'msg'=>$msg,
            'data'=>!empty($data) ? $data : []
        ];

        return response()->json($result);
    }

    public function error($msg,$data=[]){
        $result = [
            'code'=>5000,
            'msg'=>$msg,
            'data'=>!empty($data) ? $data : []
        ];

        return response()->json($result);
    }
}
